package com.itheima.dao;

import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Create By Awen on 2021/8/23
 *
 * @author Awen
 */
public interface RoleMapper {
    @Select("select * from t_role")
    List<Role> queryRoleList();

    @Select("SELECT r.* FROM t_user_role ur,t_role r WHERE ur.`role_id`=r.`id` AND ur.`user_id` = #{id}")
    List<Role> queryRoleById(int id);

    @Delete("delete from t_user_role where user_id = #{user_id}")
    void deleteRoleByUserId(@Param("user_id") int id);
}
